package ar.edu.unq.wannaplay.pages.abm.employees;

import org.apache.wicket.PageParameters;

import ar.edu.unq.wannaplay.dtos.EmployeeDTO;

public class ModifyEmployeePage extends EmployeeABM {

    private static final long serialVersionUID = 1L;

    public ModifyEmployeePage(final PageParameters parameter) {
    	super();
    	EmployeeDTO abmObject = this.getEmployeeService().getEmployeeDTOById(parameter.getString("employee"));
		this.setAbmObject(abmObject);
        this.setNewSkills(abmObject.getSkills());
        this.getIdField().setEnabled(false);
    }

    @Override
    protected void accept() {
        this.getEmployeeService().deleteById(this.getAbmObject().getId());
        this.getEmployeeService().save(this.getAbmObject());
    }
}
